package com.whl.sm.vo;


import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.whl.sm.model.assets.ComUnits;
import com.whl.sm.model.expense.MaterBill;
import com.whl.sm.model.expense.MaterRecord;
import com.whl.sm.model.system.OrgUserInfo;
import lombok.Data;

import java.util.Date;

@Data
public class MaterBillRecordVo {

    public MaterBillRecordVo(MaterBill materBill, ComUnits comUnits, MaterRecord materRecord, OrgUserInfo user){
        if (materBill != null){
            this.id = materBill.getId();
            this.materType = materBill.getMaterType();
            this.billPrice = materBill.getBillPrice();
            this.paymentStatus = materBill.getPaymentStatus();
            this.paymentTime = materBill.getPaymentTime();
            this.operator = materBill.getOperator();
            this.createTime = materBill.getCreateTime();
            this.updateTime = materBill.getUpdateTime();
        }
        if (comUnits != null){
            this.unitId = comUnits.getId();
            this.unitCode = comUnits.getUnitCode();
        }
        if (materRecord != null){
            this.oldRecord = materRecord.getOldRecord();
            this.currentRecord = materRecord.getCurrentRecord();
            this.oldRecordTime = materRecord.getOldRecordTime();
            this.oldRecordTime = materRecord.getOldRecordTime();
            this.currentRecordTime = materRecord.getCurrentRecordTime();
        }
        if( user != null){
            this.payer = user.getUserId();
            this.payerName = user.getUserName();
        }
    }



    private String id;

    /**
     * 表类型1:水表 0: 电表
     */
    private int materType;




    /**
     * 单元Id
     */
    private String unitId;

    /**
     * 单元编号
     */
    private String unitCode;


    /**
     * 账单金额
     */
    private Double billPrice;

    /**
     * 支付状态 1：已支付  2：未支付
     */
    private Integer paymentStatus;

    /**
     * 支付者
     */
    private String payer;

    /**
     * 支付者名称
     */
    private String payerName;

    /**
     * 支付时间
     */
    private Date paymentTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 操作者
     */
    private String operator;

    /**
     * 往期读数
     */
    private Double oldRecord;

    /**
     * 当期读数
     */
    private Double currentRecord;

    /**
     * 账单读数起
     *
     * */

    private Date oldRecordTime;

     /**
     * 账单读数止
     */
    private Date currentRecordTime;


}
